package com.owen.springboot.smartparkingms.module.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.owen.springboot.smartparkingms.common.model.Result;
import com.owen.springboot.smartparkingms.common.util.ShiroUtils;
import com.owen.springboot.smartparkingms.module.app.entity.ParkStatus;
import com.owen.springboot.smartparkingms.module.app.mapper.ParkStatusMapper;
import com.owen.springboot.smartparkingms.module.app.service.IParkStatusService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.owen.springboot.smartparkingms.module.sys.entity.SysUser;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Owen
 * @since 2022-02-25
 */
@Service
public class ParkStatusServiceImpl extends ServiceImpl<ParkStatusMapper, ParkStatus> implements IParkStatusService {

    @Resource
    ParkStatusMapper parkStatusMapper;

    @Override
    public Result listPage(ParkStatus parkStatus) {
        IPage<ParkStatus> page = new Page(parkStatus.getPageNo(),parkStatus.getPageSize());
        SysUser sysUser = ShiroUtils.getUserEntity();
        IPage<ParkStatus> list = parkStatusMapper.selectPageList(parkStatus.getDescription(), page,new QueryWrapper<ParkStatus>());
        return Result.ok(list);
    }
}
